
#include "ImageReader.hpp"
#include<boost/filesystem.hpp>
namespace Moduels::FramesIO
{
    void ImageReader::Init()
    {
        for(auto iterator=begin(boost::filesystem::directory_iterator(Path));
            iterator!=end(boost::filesystem::directory_iterator(Path));iterator++)
        {
            if(is_directory((*iterator)))
            {
//                std::cout<<(*iterator).path().filename()<<std::endl;
            }
            else
            {
                NumberofPicture++;
            }
        }
    }

    cv::Mat ImageReader::GetCurrentPicture()
    {
        std::string path;
        path=Path+'/'+std::to_string(Index)+Format.ImageSuffix;
        OriginPicture=cv::imread(path);
        Index++;
        if(Index==NumberofPicture+1)
        {
            Index=1;
        }
        return OriginPicture;
    }
}